# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Forms.V1.Model.FormResponse do
  @moduledoc """
  A form response.

  ## Attributes

  *   `answers` (*type:* `%{optional(String.t) => GoogleApi.Forms.V1.Model.Answer.t}`, *default:* `nil`) - Output only. The actual answers to the questions, keyed by question_id.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Timestamp for the first time the response was submitted.
  *   `formId` (*type:* `String.t`, *default:* `nil`) - Output only. The form ID.
  *   `lastSubmittedTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Timestamp for the most recent time the response was submitted. Does not track changes to grades.
  *   `respondentEmail` (*type:* `String.t`, *default:* `nil`) - Output only. The email address (if collected) for the respondent.
  *   `responseId` (*type:* `String.t`, *default:* `nil`) - Output only. The response ID.
  *   `totalScore` (*type:* `float()`, *default:* `nil`) - Output only. The total number of points the respondent received for their submission Only set if the form was a quiz and the response was graded. This includes points automatically awarded via autograding adjusted by any manual corrections entered by the form owner.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :answers => %{optional(String.t()) => GoogleApi.Forms.V1.Model.Answer.t()} | nil,
          :createTime => DateTime.t() | nil,
          :formId => String.t() | nil,
          :lastSubmittedTime => DateTime.t() | nil,
          :respondentEmail => String.t() | nil,
          :responseId => String.t() | nil,
          :totalScore => float() | nil
        }

  field(:answers, as: GoogleApi.Forms.V1.Model.Answer, type: :map)
  field(:createTime, as: DateTime)
  field(:formId)
  field(:lastSubmittedTime, as: DateTime)
  field(:respondentEmail)
  field(:responseId)
  field(:totalScore)
end

defimpl Poison.Decoder, for: GoogleApi.Forms.V1.Model.FormResponse do
  def decode(value, options) do
    GoogleApi.Forms.V1.Model.FormResponse.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Forms.V1.Model.FormResponse do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
